package com.wf.day_0611.test2;

/**
 * @author mpk
 * @since 2024/6/11 17:30:21
 */
public class MyThread extends Thread {

    static int number = 0;

    public MyThread(String name) {
        super(name);
    }

    @Override
    public void run() {
        while (true) {
            synchronized (MyThread.class) {
                if (number == 101) {
                    break;
                } else {
                    System.out.println(Thread.currentThread().getName() + "-->" + number++);
                }
            }
            try {
                Thread.sleep(10);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }

    }
}
